package com.huangpeng.designmodel.singleton;

/**
 * @Author hp
 * @Title 懒汉式-线程不安全
 * @Package
 * @Date 2022/1/19 10:10
 * @Description
 * @Version 1.0
 */
public class SlackerThreadNoSafety {
    public SlackerThreadNoSafety() {
    }
    private static SlackerThreadNoSafety slackerThreadNoSafety;
    public static SlackerThreadNoSafety getInstance(){
        if(slackerThreadNoSafety == null){
            synchronized (SlackerThreadNoSafety.class){
                slackerThreadNoSafety = new SlackerThreadNoSafety();
            }
        }
        return slackerThreadNoSafety;
    }
    public static void main(String[] args){
        SlackerThreadNoSafety a1 = SlackerThreadNoSafety.getInstance();
        System.out.println("*********** " + a1.hashCode());
        SlackerThreadNoSafety a2 = SlackerThreadNoSafety.getInstance();
        System.out.println("*********** " + a2.hashCode());
    }
}
